package org.dut.book.Enum;

import lombok.Getter;

@Getter
public enum BookStatus {
    DElETE(0,"删除"),
    NORMAL(1,"可借阅"),
    FORBIDDEN(2,"不可借阅"),
    ;
    BookStatus(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }
    private Integer code;
    private String desc;

    public  static BookStatus getStatusByCode(Integer code){
        return switch (code) {
            case 0 -> DElETE;
            case 1 -> NORMAL;
            default -> FORBIDDEN;
        };
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

}
